<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>活动抽奖</title>
<style>
#lottery{width:100%;height:100%;margin:0px auto;border:4px;}
#lottery table{}
#lottery table td{position:relative;width:205px;height:150px;text-align:center;color:#333;font-index:-999}
#lottery table td img{display:block;height:185px;padding-bottom: 20px;}/*width:205px*/
#lottery table td a{width:205px;height:150px;display:block;text-decoration:none;}
#lottery table td a:hover{}
#lottery table td.active .mask{display:block;width: 300px;height: 220px;position: absolute;border-radius: 26px;}
.mask{
    width:100%;
    height:100%;
    position:absolute;
    left:0;
    top:0;
    background-color: rgba(245,222,13,0.6);
    display:none;
}
</style>
</head>
<body class="keBody" style="background: #FEE40B;margin: 0px;">
<!-- 头部 -->
<div style="width:108%;height: 100%;">
    <img src="__PUBLIC__/mobile/dzp/images/top.png" width="100%;">
</div>
<div style="height:40px;">
    <span style="font-size: 28px;padding-left: 50px;color: #5D0107;font-weight: bold;">用户：{$info.phone}</span>
    <a href="{:U('mobile/dzp/lw')}" style="font-size: 28px;color: #5D0107;font-weight: bold;position: absolute;right: 0px;">抽奖记录</a>
</div>
<!-- 抽奖 -->
<div style="width: 104%;height: 856px;background:url(__PUBLIC__/mobile/dzp/images/cj.png) no-repeat top center;background-size: 99% 100%;background-position: 20px;">
<!--效果html开始-->
    <div id="lottery" style="padding-left: 40px;">
        <table border="0" cellpadding="2" cellspacing="30" style="height: 100%;width: 100%;">
            <tr>
                <td class="lottery-unit lottery-unit-0"><img src="__PUBLIC__/mobile/dzp/images/0.png"><div class="mask" style="left: -10px;top: 10px;"></div></td>
                <td class="lottery-unit lottery-unit-1"><img src="__PUBLIC__/mobile/dzp/images/1.png"><div class="mask" style="left: -27px;top: 10px;"></div></td>
                <td class="lottery-unit lottery-unit-2"><img src="__PUBLIC__/mobile/dzp/images/2.png"><div class="mask" style="left: -43px;top: 10px;"></div></td>
            </tr>
            <tr>
                <td class="lottery-unit lottery-unit-7"><img src="__PUBLIC__/mobile/dzp/images/7.png"><div class="mask" style="left: -10px"></div></td>
                <td style="left: -40px;" id="dianji">
                    <?php if ($_COOKIE['name'] == encrypt(decrypt($_COOKIE['name'], 'cj'),'cj') && !empty($info)) { ?>
                        <?php if ($is_cj) { ?>
                            <span onclick="tj_ycj()" style="display: block;width: 100%;height: 100%;"></span>
                        <?php }else { ?>
                            <a href="javascript:;" style="width: 100%;height: 100%;"></a>
                        <?php } ?>
                    <?php }else { ?>
                        <span onclick="tj_mdl()" style="display: block;width: 100%;height: 100%;"></span>
                    <?php } ?>
                </td>
                <td class="lottery-unit lottery-unit-3"><img src="__PUBLIC__/mobile/dzp/images/3.png"><div class="mask" style="left: -43px;"></div></td>
            </tr>
            <tr>
                <td class="lottery-unit lottery-unit-6"><img src="__PUBLIC__/mobile/dzp/images/6.png"><div class="mask" style="left: -10px;top: -10px;"></div></td>
                <td class="lottery-unit lottery-unit-5"><img src="__PUBLIC__/mobile/dzp/images/5.png"><div class="mask" style="left: -25px;top: -12px;"></div></td>
                <td class="lottery-unit lottery-unit-4"><img src="__PUBLIC__/mobile/dzp/images/4.png"><div class="mask" style="left: -43px;top: -12px;"></div></td>
            </tr>
        </table>
    </div>
</div>
<div style="height:40px;">
    <span style="font-size: 28px;padding-left: 50px;color: #5D0107;font-weight: bold;">参与人数：<?php echo $rcount+2600 ?> 人</span>
    <span style="font-size: 28px;padding-left: 420px;color: #5D0107;font-weight: bold;">抽奖次数：<?php echo $ccount+6600 ?> 次</span>
</div>
<!-- 活动规则 -->
<div style="width: 100%;height: 100%;padding-left: 10px;">
    <p onclick="tisx()" style="font-size: 28px;background: #FCB702;width: 120px;margin-left: 50px;padding: 8px;border-radius: 8px;padding-left: 15px;font-weight: bold;color: #5e0208;">活动规则</p>
    <img src="__PUBLIC__/mobile/dzp/images/gz.png" width="100%;">
</div>

<script type="text/javascript" src="__PUBLIC__/mobile/js/jquery-1.8.3.min.js"></script>

<link href="__PUBLIC__/mobile/dzp/layer_mobile/need/layer.css" rel="stylesheet" type="text/css" media="all"/>
<script type="text/javascript" src="__PUBLIC__/mobile/dzp/layer_mobile/layer.js"></script>


<script type="text/javascript">
    var lottery={
        index:-1,   //当前转动到哪个位置，起点位置
        count:0,    //总共有多少个位置
        timer:0,    //setTimeout的ID，用clearTimeout清除
        speed:20,   //初始转动速度
        times:0,    //转动次数
        cycle:50,   //转动基本次数：即至少需要转动多少次再进入抽奖环节
        prize:-1,   //中奖位置
        init:function(id){
            if ($("#"+id).find(".lottery-unit").length>0) {
                $lottery = $("#"+id);
                $units = $lottery.find(".lottery-unit");
                this.obj = $lottery;
                this.count = $units.length;
                $lottery.find(".lottery-unit-"+this.index).addClass("active");
            };
        },
        roll:function(){
            var index = this.index;
            var count = this.count;
            var lottery = this.obj;
            $(lottery).find(".lottery-unit-"+index).removeClass("active");
            index += 1;
            if (index>count-1) {
                index = 0;
            };
            $(lottery).find(".lottery-unit-"+index).addClass("active");
            this.index=index;
            return false;
        },
        stop:function(index){
            this.prize=index;
            return false;
        }
    };
    function roll(){
        lottery.times += 1;
        lottery.roll();
        var prize_site = $("#lottery").attr("prize_site");
        if (lottery.times > lottery.cycle+10 && lottery.index==prize_site) {
            var prize_id = $("#lottery").attr("prize_id");
            var prize_name = $("#lottery").attr("prize_name");
            //alert("前端中奖位置："+prize_site+"\n"+"中奖名称："+prize_name+"\n中奖id："+prize_id)
            clearTimeout(lottery.timer);
            lottery.prize=-1;
            lottery.times=0;
            click=false;
        }else{
            if (lottery.times<lottery.cycle) {
                lottery.speed -= 10;
            }else if(lottery.times==lottery.cycle) {
                var index = Math.random()*(lottery.count)|0; //几率 lottery.count
                lottery.prize = index;      
            }else{
                if (lottery.times > lottery.cycle+10 && ((lottery.prize==0 && lottery.index==7) || lottery.prize==lottery.index+1)) {
                    lottery.speed += 110;
                }else{
                    lottery.speed += 20;
                }
            }
            if (lottery.speed<40) {
                lottery.speed=40;
            };
            //console.log(lottery.times+'测试并发次数'+lottery.speed+'测试转数'+lottery.prize);
            lottery.timer = setTimeout(roll,lottery.speed);
        }
        return false;
    }

    var click=false;

    $(function() {
        lottery.init('lottery');
        $("#lottery a").click(function() {
             if (click) {
                return false;
            } else {
                lottery.speed = 100;
                $.post("{:U('mobile/dzp/zj')}", {uid: 1}, function(data) { //获取奖品，也可以在这里判断是否登陆状态
                    $("#lottery").attr("prize_site", data.prize_site);
                    $("#lottery").attr("prize_id", data.prize_id);
                    $("#lottery").attr("prize_name", data.prize_name);

                    setTimeout("tj_zj('"+data.prize_name+"')",5000);//5秒后显示DIV
                    roll();
                    click = true;
                    return false;
                }, "json")
            }
        });
    })
</script>

<script>
 function tj_mdl(){
      //询问框
      layer.open({
        content: '请验证你的手机号码？'
        ,style: 'font-size:28px;padding:5px;' //自定风格
        ,btn: ['去验证', '取消']
        ,yes: function(index){
          location.href = "{:U('mobile/dzp/tj')}";
          layer.close(index);
        }
      });
 }

function tj_ycj(){
  //提示
  layer.open({
    content: '今天你已经抽过奖哦'
    ,skin: 'msg'
    ,style: 'font-size:28px;padding:5px;' //自定风格
    ,time: 3 //3秒后自动关闭
  });
 }

// function tj_zj(name){
//   //提示
//   layer.open({
//     content: '本次抽中奖项是:'+name
//     ,skin: 'msg'
//     ,style: 'font-size:24px;padding:5px;' //自定风格
//     ,time: 3 //3秒后自动关闭
//   });
//  }

 function tj_zj(name)
 {
    layer.open({
      content: name
      ,style: 'font-size:30px;padding:5px;' //自定风格
      ,btn: '我知道了'
      ,shadeClose: false
      ,yes: function(){
          //location.reload();
          location.href = "{:U('mobile/dzp/lw')}";
          layer.close(index);
      }
    });
 }

function tisx()
{
  layer.open({
    title: [
      '活动规则',
      'background-color: #FFF2CE; color:#5e0208;font-size: 32px;margin-bottom: -20px;'
    ]
    ,content: '<p style="text-align: left;line-height: 40px;">1、在活动期内，每个账户每日可抽奖1次，每次报读只能使用一张现金券；数量有限，送完即止；</p><p style="text-align: left;line-height: 40px;">2、在天湘土菜馆消费满100减20；满200减30；满300减50地址：广州市番禺区大石迎宾路金辉大酒店天湘土菜馆</p><p style="text-align: left;line-height: 40px;">3、现金抵用券使用方法：即报读任意档次班型，可使用现金抵用券1000元抵扣等额学费；报读课时如有退费，不计算在退费的金额内；</p><p style="text-align: left;line-height: 40px;">4、1对1辅导课时9次，其中报读A档兑换3课时，报读B档兑换6课时，报读C档以上兑换9课时；</p><p style="text-align: left;line-height: 40px;">5、试课券使用方法：免费预约资深在职老师上门试课，课时40分钟；</p><p style="text-align: left;line-height: 40px;">6、抽中华为Mate9、iPadmini4等实物奖品，将会有专人联系您，确认收货地址后以邮寄形式派送；</p><p style="line-height: 40px;">本活动解析权归广州尚门教育信息咨询有限公司</p>'
    ,style: 'background-color:#FFF2CE; color:#5e0208; border:none;font-size: 30px;margin-left: 50px;max-width: 720px;' //自定风格
  });
}
</script>


</body>
</html>